package Day14;

public class Demo05 {
    public static void main(String[] args) {
        //使用集合存储快递
        View v = new View();
        DoExpress d = new DoExpress();
        bb:while (true) {
            int a = v.xxx();
            aa:
            switch (a) {
                case 1: {
                    int b = v.courier();
                    switch (b) {
                        case 1: {//存快递
                            boolean b1 =d.add(v.add());
                            if(b1 == true){

                                System.out.println("添加成功");
                            }else{
                                System.out.println("添加失败");
                            }
                            break;
                        }
                        case 2: {//删除快递
                           int number = v.delete();
                           if(d.findByNumber(number) == null){
                               System.out.println("找不到该快递");
                           }else{
                               d.delete(d.findByNumber(number));
                               System.out.println("删除成功");
                           }
                            break;
                        }
                        case 3: {//修改快递
                            int number = v.findByNumber();
                            if(d.findByNumber(number) == null){
                                System.out.println("找不到该快递");
                            }else{
                                d.revise(d.findByNumber(number),v.revise());
                            }
                        }
                        case 4: {//查看所有快递
                            d.printlnAll();
//                            v.printAll();
                            break;
                        }
                        case 0: {//退出
                            break aa;
                        }
                        default:
                            System.out.println("输入错误");
                    }
                    break;
                }
                case 2:{//用户  取快递
                    d.user();
                    break ;
                }
                case 0:{
                    break bb;
                }
                default:
                    System.out.println("输入错误");
            }
        }
    }
}
